<template>
<view>
<!--pages/orderDetails/orderDetails.wxml-->
<!-- 订单状态 -->
<view class="orderStatesWrap">
	<view class="orderStatesImg">
		<image width="61rpx" heigth="65rpx" v-if="payOrder.state==1" src="/static/images/orderStates.png"></image>
		<image width="61rpx" heigth="65rpx" v-else src="/static/images/orderStates2.png"></image>
	</view>
	<view class="orderStates">
		<view>
			<text v-if="payOrder.state==1">交易成功</text>
			<text v-else>交易关闭</text>
		</view>
		<view class="pay-money-color">
			<text v-if="payOrder.state==1">订单已付款</text>
			<text v-else>超时未付款，订单自动关闭</text>
		</view>
	</view>
</view>
<!-- 收货地址 -->
<view class="regionWrap">
	<view class="regionInfo">
		<view class="regionPosition">
			<image src="/static/images/regionPosition.png"></image>
		</view>
		<view class="regionInfo-box">
			<view class="box-info">
				<text>姓名：{{payOrder.user_name}}</text>
				<text>手机：{{payOrder.user_phone}}</text>
			</view>
			<view class="region" v-if="payOrder.user_address">{{ payOrder.user_address }}</view>
		</view>
	</view>
	<!-- boeder-bottom -->
	<view class="regionbom">
		<image src="/static/images/regionbom.png"></image>
	</view>
</view>
<!--商品  -->
<view class="payShop">
	<block :key="index">
		<view class="orderWrap">
			<view class="orderImg">
				<image mode="aspectFit" :src="payOrder.image"></image>
				<view class="hot" v-if="payOrder.isHot==0">
					<image src="/static/images/hot.png"></image>
				</view>
			</view>
			<view class="orderName">{{payOrder.goods_name}}</view>
			<view class="orderPrice">
				<view>￥{{payOrder.spike_price}}</view>
				<view>{{payOrder.sku_name}}</view>
				<view>x{{payOrder.buy_number}}</view>
			</view>
		</view>
	</block>
	<view class="orderAll">
		<text>小计：<text class="pay-order-allmoney">￥{{payOrder.all_money}}</text></text>
	</view>
</view>
<!--  -->
<view class="DistributionWrap">
	<view class="DistributionList">
		<view class="listLabel">配送方式</view>
		<view class="listCom">
			<view v-if="payOrder.pickup_type==1">到店自提</view>
			<view v-else>
				<text>商家配送</text>
				<view class="copy copy-two" type="default" size="mini" v-if="payOrder.delivery_type == 4" @tap="seeLogistics">查看物流</view>
			</view>
		</view>
	</view>
	<view class="wordlist">
		<view class="listLabel">买家留言</view>
		<view class="listCom">
			<text>{{payOrder.remark?payOrder.remark:''}}</text>
		</view>
	</view>
</view>

<view class="orderNumber">
	<view class="numberList">
		<text>订单编号：</text>
		<text>{{payOrder.order_no}}</text>
		<view @tap="copy" class="copy" type="default" size="mini">复制</view>
	</view>
	<view class="numberList">
		<text>创建时间：</text>
		<text>{{payOrder.add_time}}</text>
	</view>
</view>
</view>
</template>

<script>
// pages/orderDetails/orderDetails.js
var app = getApp().globalData;

export default {
  data() {
    return {
      payOrder: []
    };
  },

  components: {},
  props: {},
  // 加载页面
  onLoad: function (options) {
    var id = options.order_id;
    var that = this;
    getApp().globalData.sendRequest({
      url: '/Spike/getSpikeOrderDetails',
      data: {
        bill_id: id
      },
      type: "post",

      success(res) {
        if (res.status == 1) {
          that.setData({
            payOrder: res.spike_order
          });
        }
      }

    });
  },
  methods: {
    //查看物流
    seeLogistics: function (e) {
      var payOrder = this.payOrder;
      uni.navigateTo({
        url: '../logistics/logistics?order_no=' + payOrder.order_no
      });
    },

    // 复制
    copy() {
      uni.setClipboardData({
        data: this.payOrder.order_no,

        success(res) {
          uni.getClipboardData({
            success(res) {// console.log(res.data) // data
            }

          });
        }

      });
    },

    // 疑问
    assistant() {
      uni.navigateTo({
        url: '../assistant/assistant'
      });
    }

  }
};
</script>
<style>
@import "./orderDetails.css";
</style>